package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.EmployeeLoginDTO;
import com.sky.dto.EmployeePageQueryDTO;
import com.sky.entity.Employee;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

@Mapper
public interface EmployeeMapper {
    /**
     * 检查登录名是否正确
     * @param username
     * @return
     */
    @Select("SELECT * from sky_take_out.employee where username=#{username}")
    Employee checkUsernname(String username);



    /**
     * 插入一个新的员工
     * @param employee
     */
    @AutoFill(value = OperationType.INSERT)
    void insert(Employee employee);

    /**
     * 分页查询员工
     * @param employeePageQueryDTO
     * @return
     */
    Page<Object> pageQuery(EmployeePageQueryDTO employeePageQueryDTO);

    /**
     * 更新员工状态
     * @param employee
     */
   @AutoFill(value = OperationType.UPDATE)
    void updateEmp(Employee employee);

    /**
     * 根据id查找员工
     * @param id
     * @return
     */
    @Select("select * from employee  where id=#{id}")
    Employee getById(Long id);

}
